#include <iostream>
#include <vector>
using namespace std;
#include "AVLTree.h"



//int main() {
//	//int a[] = { 16, 3, 7, 11, 9, 26, 18, 14, 15 };
//	int a[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
//	AVLTree<int, int> t;
//	for (auto e : a)
//	{
//		t.Insert(make_pair(e, e));
//	}
//	t.InOrder();
//	cout << "Is : " << t.IsBalance() << endl;
//	cout<<"Height : " << t.Height() << endl;
//	return 0;
//}


int main()
{
	const int N = 1000000;
	vector<int> v;
	v.reserve(N);
	srand(time(0));
	
	for (size_t i = 0; i < N; i++)
	{
		v.push_back(rand()+i);
		//cout << v.back() << endl;
	}
	
	int begin1 = clock();
	AVLTree<int, int> t;
	for (auto e : v)
	{
		t.Insert(make_pair(e, e));
		//cout << "Insert:" << e << "->" << t.IsBalance() << endl;
	}
	int end1 = clock();
	cout << "end1 - begin1 : " << end1 - begin1 << endl;

	int begin2 = clock();
	for (auto& e : v)
	{
		t.Fnid(e);
	}
	int end2 = clock();
	cout << "end2 - begin2 : " << end2 - begin2 << endl;

	//cout << "Is : " << t.IsBalance() << endl;
	cout<<"Height : " << t.Height() << endl;

	return 0;
}